<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:util="http://java.sun.com/jsf/composite/util">

<ui:composition>
	<h:outputStylesheet library="css" name="components/smallBasket.css"></h:outputStylesheet>
	<h:form>
		<rich:dataTable id="basketPanel" style="width:100%;"
			iterationStatusVar="it" value="#{basketBean.book_list}" var="var">
			<f:facet name="header">
				Koszyk
            </f:facet>
			<rich:column>
				#{it.index+1}
			</rich:column>

			<rich:column>
				<h:outputText value="#{var.book.title}" styleClass="bookTitleCart" />
			</rich:column>

			<rich:column>
				<h:outputText value="#{var.book.price}" styleClass="bookPriceCart">
					<f:convertNumber type="currency" pattern="  #0.00 zł" />
				</h:outputText>
			</rich:column>

			<rich:column>
				<h:inputText value="#{var.books_in_basket}" immediate="true"
					valueChangeListener="#{basketBean.changeNumberOfBooks}" size="1" />
			</rich:column>


			<rich:column>
				<rich:panel bodyClass="bookRemove"
					style="cursor: pointer; background: url(../resources/images/remove.png) no-repeat center;">
					<f:ajax event="click" listener="#{basketBean.removeBook}"
						render="@all" />
					<f:attribute name="book" value="#{var}" />
				</rich:panel>
			</rich:column>

			<f:facet name="footer">
                Suma: <h:outputText value="#{basketBean.price}">
					<f:convertNumber type="currency" pattern="  #0.00 zł" />
				</h:outputText>
			</f:facet>
		</rich:dataTable>
		<h:commandButton value="Zrealizuj koszyk"
			action="#{jsfutils.redirect('mainContent/continueShoppingPage')}"
			styleClass="basketButton" />

	</h:form>
</ui:composition>
</html>
